// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   DBFactory.java
package cn.org.zx.db.dbconnection;

import java.sql.Connection;
import javax.naming.NamingException;

import cn.org.zx.db.dbconnection.impl.SQLDBConnection;
import cn.org.zx.db.dbconnection.impl.OracleDBConnection;
import cn.org.zx.db.dbconnection.impl.MysqlDBConnection;
import cn.org.zx.db.dbexception.DBErrorException;
import cn.org.zx.db.dbconnection.DBProperties;

public class DBFactory{
	public DBFactory(){
    }

    public static Connection getConnection() throws DBErrorException
    {
    	String strDBType = DBProperties.getDBType();    	
    	DBConnection dbc = null;
    	if(strDBType.equals("sqlserver")){    		
    		dbc = new SQLDBConnection();    		
    		dbc.openbyJNDI("java:comp/env/jdbc/sqlserver");
    	}
    	else if(strDBType.equals("oracle")){
    		dbc = new OracleDBConnection();
    		dbc.openbyJNDI("java:comp/env/jdbc/oracle");
    	}
    	else if(strDBType.equals("mysql")){
    		dbc = new MysqlDBConnection();
    		dbc.openbyJNDI("java:comp/env/jdbc/mysql");
    	}
    	else{
    		
    	}
  		
        //
        return dbc.getConnection();
    }
    
    public static void main(String[] args) throws DBErrorException, NamingException, Exception {
    	
		
	}
}
